<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>FileGetTime</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>FileGetTime</h1>

<p>Retrieves the datetime stamp of a file or folder.</p>

<pre class="Syntax">FileGetTime, OutputVar [, Filename, WhichTime]</pre>
<h3>Parameters</h3>
<dl>

  <dt>OutputVar</dt>
  <dd><p>The name of the variable in which to store the retrieved date-time in format <a href="FileSetTime.htm#YYYYMMDD">YYYYMMDDHH24MISS</a>. The time is your own local time, not UTC/GMT.</p></dd>

  <dt>Filename</dt>
  <dd><p>The name of the target file or folder, which is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified. If omitted, the current file of the innermost enclosing <a href="LoopFile.htm">File-Loop</a> will be used instead.</p></dd>

  <dt>WhichTime</dt>
  <dd>Which timestamp to retrieve:<br>
      M = Modification time (this is the default if the parameter is omitted)<br>
      C = Creation time<br>
      A = Last access time</dd>

</dl>

<h3>ErrorLevel</h3>
<p><span class="ver">[v1.1.04+]</span> This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<p><a href="../Variables.htm#LastError">A_LastError</a> is set to the result of the operating system's GetLastError() function.</p>

<h3>Remarks</h3>
<p>See <a href="FileSetTime.htm#YYYYMMDD">YYYYMMDDHH24MISS</a> for an explanation of dates and times.</p>
<h3>Related</h3>
<p><a href="FileSetTime.htm">FileSetTime</a>, <a href="FormatTime.htm">FormatTime</a>, <a href="IfIs.htm">If var is [not] type</a>, <a href="FileGetAttrib.htm">FileGetAttrib</a>, <a href="FileSetAttrib.htm">FileSetAttrib</a>, <a href="FileGetSize.htm">FileGetSize</a>, <a href="FileGetVersion.htm">FileGetVersion</a>, <a href="LoopFile.htm">File-loop</a>, <a href="EnvAdd.htm">EnvAdd</a>, <a href="EnvSub.htm">EnvSub</a></p>
<h3>Example</h3>
<pre class="NoIndent">FileGetTime, OutputVar, C:\My Documents\test.doc  <em>; Retrieves the modification time by default.</em>
FileGetTime, OutputVar, C:\My Documents\test.doc, C  <em>; Retrieves the creation time.</em></pre>

</body>
</html>
